package com.example.gamedemo;

import com.example.gamedemo.util.SystemUiHider;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class FullscreenActivity extends Activity {

	Button btnGame1, btnGame2, btnGame3, btnExit;
	Button ibtnOn, ibtnOff;
	int cdsMusic;
	int i;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);

		setContentView(R.layout.activity_fullscreen);

		btnGame1 = (Button) findViewById(R.id.btnGame1_GameDemo);
		btnGame3 = (Button) findViewById(R.id.btnGame3_GameDemo);

		btnExit = (Button) findViewById(R.id.btnExitMain_GameDemo);

		ibtnOn = (Button) findViewById(R.id.ibtnOn_Main);
		ibtnOff = (Button) findViewById(R.id.ibtnOff_Main);

		if (i == 0) {
			i = 1;
			Intent intent = new Intent(FullscreenActivity.this,
					ServiceMusic.class);
			startService(intent);
			ibtnOn.setVisibility(View.INVISIBLE);
		}

		btnExit.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(FullscreenActivity.this,
						ServiceMusic.class);
				stopService(intent);
				finish();
			}
		});

		btnGame1.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(FullscreenActivity.this,
						ServiceMusicDung.class);
				startService(intent);
				Intent intent1 = new Intent(FullscreenActivity.this,
						ServiceMusic.class);
				stopService(intent1);
				Intent intent2 = new Intent(FullscreenActivity.this,
						Game1.class);
				startActivity(intent2);
			}
		});

		btnGame3.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(FullscreenActivity.this,
						ServiceMusicDung.class);
				startService(intent);
				Intent intent1 = new Intent(FullscreenActivity.this,
						ServiceMusic.class);
				stopService(intent1);
				Intent intent2 = new Intent(FullscreenActivity.this,
						Game3.class);
				startActivity(intent2);
			}
		});
		ibtnOn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub

				Intent intent = new Intent(FullscreenActivity.this,
						ServiceMusic.class);
				startService(intent);
				ibtnOn.setVisibility(View.INVISIBLE);
				ibtnOff.setVisibility(View.VISIBLE);

			}
		});
		ibtnOff.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(FullscreenActivity.this,
						ServiceMusic.class);
				stopService(intent);
				ibtnOff.setVisibility(View.INVISIBLE);
				ibtnOn.setVisibility(View.VISIBLE);

			}
		});
	}

}
